<?php
class Transport
{

      public  $typeCom = ''; //快递公司 对应参数com
      public  $typeNu = '';  //快递单号 对应参数nu
      public  $AppKey='590e0f6171729df4';    //秘钥 对应参数id
      public  $url ='';
      public  $get_content = '';
      public  $show = 2;  //0：返回json字符串，1：返回xml对象，2：返回html对象，3：返回text文本。
      public  $order = 'asc';
      public  $muti = 1;//返回信息数量：1:返回多行完整的信息，0:只返回一行信息。
      private $support = array();

      public function __construct(){
          $this->support = array(
              'shentong',
              'zhongtong'
          );

      }
      public function curl(){
          $this->__init();
          if (function_exists('curl_init') == 1){
              $curl = curl_init();
              curl_setopt ($curl, CURLOPT_URL, $this->url);
              curl_setopt ($curl, CURLOPT_HEADER,0);
              curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt ($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
              curl_setopt ($curl, CURLOPT_TIMEOUT,5);
              $get_content = curl_exec($curl);
              curl_close ($curl);
          }else{
              $snoopy = $this->load->library('snoopy');
              $snoopy->referer = 'http://www.google.com/';//伪装来源
              $snoopy->fetch($this->url);
              $get_content = $snoopy->results;
          }
          $this->get_content = $get_content;
      }
      public function __init(){
          $this->url = 'http://api.kuaidi100.com/api?id='.$this->AppKey.'&com='.$this->typeCom.'&nu='.$this->typeNu.'&show='.$this->show.'&muti='.$this->muti.'&order='.$this->order;
          //$this->url = 'http://www.kuaidi100.com/applyurl?com='.$this->typeCom.'&nu='.$this->typeNu;
      }

}